<script type="text/javascript">
function open_win(url_add)
{
	mywindow=window.open(url_add,'welcome','width=500,height=600,menubar=no,status=no,location=no,toolbar=no,scrollbars=no');
    mywindow.moveTo(300, 200);
}

function openWindow(anchor, options) {
	 
	var args = '';
 
	if (typeof(options) == 'undefined') { var options = new Object(); }
	if (typeof(options.name) == 'undefined') { options.name = 'win' + Math.round(Math.random()*100000); }
 
	if (typeof(options.height) != 'undefined' && typeof(options.fullscreen) == 'undefined') {
		args += "height=" + options.height + ",";
	}
 
	if (typeof(options.width) != 'undefined' && typeof(options.fullscreen) == 'undefined') {
		args += "width=" + options.width + ",";
	}
 
	if (typeof(options.fullscreen) != 'undefined') {
		args += "width=" + screen.availWidth + ",";
		args += "height=" + screen.availHeight + ",";
	}
 
	if (typeof(options.center) == 'undefined') {
		options.x = 0;
		options.y = 0;
		args += "screenx=" + options.x + ",";
		args += "screeny=" + options.y + ",";
		args += "left=" + options.x + ",";
		args += "top=" + options.y + ",";
	}
 
	if (typeof(options.center) != 'undefined' && typeof(options.fullscreen) == 'undefined') {
		options.y=Math.floor((screen.availHeight-(options.height || screen.height))/2)-(screen.height-screen.availHeight);
		options.x=Math.floor((screen.availWidth-(options.width || screen.width))/2)-(screen.width-screen.availWidth);
		args += "screenx=" + options.x + ",";
		args += "screeny=" + options.y + ",";
		args += "left=" + options.x + ",";
		args += "top=" + options.y + ",";
	}
 
	if (typeof(options.scrollbars) != 'undefined') { args += "scrollbars=1,"; }
	if (typeof(options.menubar) != 'undefined') { args += "menubar=1,"; }
	if (typeof(options.locationbar) != 'undefined') { args += "location=1,"; }
	if (typeof(options.resizable) != 'undefined') { args += "resizable=1,"; }
 
	var win = window.open(anchor, options.name, args);
	return false;
 
}
</script>


<form name="appForm" method="post" action="" id="appForm">
<?php echo $this->render('/comments/include/toolbar.php');?>
<?php echo $this->render('/comments/include/submenu.php');?>


 <!-- BEGIN: CONTENT -->
 <div id="element-box">
   <div class="t">
     <div class="t">
        <div class="t"></div>
   </div>
     </div>
<div class="m">
   <!-- BEGIN: ELEMENT BOX -->
       <!-- Area 4: In du lieu lay tu database -->
     <div id="subicon_left">
       <?php echo $this->searchButton($this->keyword); ?>
       
     
     </div>
     
     <div id="subicon_right">
        <?php 
             	
                echo $this->stateButton($name='secnews',$default='Select Section',$this->list);
        ?>
        <?php 
             	
                echo $this->stateButton($name='catnews',$default='Select Category',$this->cat);
        ?>
         <?php 
             	
                echo $this->stateButton($name='tours',$default='Select Product',$this->product);
        ?>
        <?php 
             	$a['1']="Published";
                $a['0']="Unpublished";
                echo $this->stateButton($name='status',$default='-Select Sate-',$a);
        ?>
        
     </div>  
           <table class="adminlist" width="100%">
               <thead>
                   <tr>
                     <th width="50" ><input type="checkbox" name="checkall" id="checkall" onclick="checkedAll();"></th>
                     <th width="350">Title</th>
                     <th width="80">Published</th>
                     <th width="80">Order</th>	
                     <th width="150">Email</th>
                     <th width="250">Comments</th>	
                     <th width="250">Send mail</th>	
                     <th width="250">Product</th>	
                     <th width="100">Controller</th>						
                     <th width="80">ID</th>
                   </tr>
               </thead>
               <?php 
                  
				  if(count($this->paginator)>0){
				    	$i=0;
					  foreach ($this->paginator as $key => $val){
						$id 		    = $val['id'];
						$title 		    = $val['title'];
						$status     	= $val['published'];
					   	$theloai     	= $val['tensanpham'];
					   	$email     	    = $val['email'];
					   	
						$imgScr =  "images/icon/inactive.png";
						
						$attribs = array('icon'=>'inactive.png',
										 'iconDir' => "images/icon/");
						if($val['published']== 1)
						{		
							$attribs['icon'] = 'active.png';
						}
						$lnkStatus  = $this->url(array('action'=>'status','id'=> $id,'s'=>$val['published']));
						$status 	= $this->cmsIcon('status',$lnkStatus,$attribs);
						
						$ordering 		= $this->formText('order[' . $val['id'] . ']',$val['order'],array('style'=>'width: 30px; text-align: center;'));

						$lnkSate  = $this->url(array('action'=>'state','id'=> $val['id']));
						$iconSate = $this->IconButton('Edit item',$lnkSate,array('icon'=>'edit.png'));
																						
						$lnkEdit  = $this->url(array('action'=>'edit','id'=> $val['id']));
						$iconEdit = $this->IconButton('Edit item',$lnkEdit,array('icon'=>'edit.png'));
						
						$lnkInfo  = $this->url(array('action'=>'info','id'=> $val['id']));
						$iconInfo = $this->cmsIcon('View Info',$lnkInfo,array('icon'=>'icon_info.png'));
												
						$lnkDel  = $this->url(array('action'=>'delete','id'=> $val['id']));
						$iconDel = $this->IconButton('Delete item',$lnkDel,array('icon'=>'action_delete.gif'));
												
						$strIcon = $iconEdit.$iconDel;
						$cid = $this->formCheckbox('cid[]',$val['id'],array('class'=>'check'));
				
					?>

               <tr class="<?php  if($i%2==0) echo chan ; else echo le;?> hori">						
                         <td align="center"><?php  echo $cid;?></td>
                         <td align="left"><a href="<?php echo JURI_BACK; ?>category-product/edit/id/<?php echo $id;?>"><?php  echo $title;?></a> </td>
                         <td align="center"><?php  echo $status;?> </td>
                         <td align="center"><?php  echo $ordering;?></td>
                         <td align="center"><?php  echo $email;?></td>
                         <td align="center">
                           <a HREF="javascript:void(0)" onclick="openWindow('<?php echo JURI_BACK.'comments/info/id/'.$val['id']; ?>',{width:790,height:750,center:true})">
                           <img src="<?php echo JURI.'/public/templates/admin/system/images/icon/moin-show.png'; ?>"></a>
                         </td>
                         <td align="center">Send Mail</td>      
                         <td align="center"><?php  echo $theloai;?></td>                     
                         <td align="center"><?php echo $strIcon;?></td>   
                         <td align="center"><?php  echo $id;?></td>          
                         
               </tr>         
                    <?php 
                       $i++;
						}
					}
                	?>            
                                    <!-- BEGIN: PAGINATION (FOOT) -->
                                    <tfoot>
                                        <tr>
                                            <td colspan="10">
                                                <div class="container">
                                                    <div class="pagination">
                                                           <?php echo  $this->paginationControl($this->paginator, 'Sliding', 'paging.phtml'); ?>	      
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>					
                                    </tfoot>				<!-- END: PAGINATION (FOOT) -->
                                </table>
                                <!-- Area 4: In du lieu lay tu database - End -->

                                <!-- END: ELEMENT BOX -->	
                              <div class="clr"></div>
                            </div>
                            <div class="b">
                                <div class="b">
                                    <div class="b"></div>
                                </div>
                            </div>
                        </div>
                        <!-- END: 	CONTENT -->
<input type="hidden" value="<?php echo $this->arrParam['id'];?>" name="id_key">
</form>